package exam.美团笔试;

import java.util.Scanner;

/**
 * @author chenhong
 * @version 1.0
 * @description TODO
 * @date 2023/4/1 11:10
 */
public class Main3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] total = new int[n];
        for (int i = 0; i < n; i++) {
            total[i] = scanner.nextInt();
        }
        int[] cur = new int[n];
        for (int i = 0; i < n; i++) {
            cur[i] = scanner.nextInt();
        }
        int[] need = new int[n];
        for (int i = 0; i < n; i++) {
            need[i] = scanner.nextInt();
        }
        int[] dp = new int[n];
        dp[0] = (total[0] - cur[0]) * need[0];
        int[][] minNeed = new int[n][n];
        for (int i = 0; i < n; i++) {
            int minNum = Integer.MAX_VALUE;
            for (int j = i; j < n; j++) {
                if (need[j] < minNum)
                    minNum = need[j];
                minNeed[i][j] = minNum;
            }
        }
        for (int i = 1; i < dp.length; i++) {
            int mindp = Integer.MAX_VALUE;
            int k = total[i] - cur[i];
            int countdp = 0;
            for(int i1 = 0;i1<i;i1++)
                countdp += dp[i1];
            for (int j = 0; j < i; j++) {
                mindp = Math.min(mindp,countdp + minNeed[j][i - 1] * k);
                countdp -= dp[j];
            }
            int need2 = need[i] * k;
            dp[i] = Math.min(mindp, need2);
        }
        int m = scanner.nextInt();
        int[] index = new int[m];
        for (int i = 0; i < m; i++) {
            index[i] = scanner.nextInt();
        }
        for (int i = 0; i < m; i++) {
            System.out.print(dp[index[i] - 1] + " ");
        }
    }
}
